package com.gaga.metadata.common.enums;

/**
 * @Description //TODO
 * @Date 2023/8/3 18:08
 * @Author zhipeng.yang
 **/
public enum IndexUpdateType {
    NAME("name", "修改列名称", "name", false),
    INDEXTYPE("indexType", "修改索引类型", "indexType", false),
    DESC("desc", "修改索引描述", "desc", false);


    private String code;
    private String desc;
    private String modelIndexMapper;
    private Boolean needValidateData;

    IndexUpdateType(String code, String desc, String modelIndexMapper, Boolean needValidateData) {
        this.code = code;
        this.desc = desc;
        this.modelIndexMapper = modelIndexMapper;
        this.needValidateData = needValidateData;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getModelIndexMapper() {
        return modelIndexMapper;
    }

    public Boolean getNeedValidateData() {
        return needValidateData;
    }

    public static IndexUpdateType ofCode(String modelIndexMapper) {
        for (IndexUpdateType dbType : values()) {
            if (dbType.modelIndexMapper.equalsIgnoreCase(modelIndexMapper)) {
                return dbType;
            }
        }
        return null;
    }
}
